﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using GmaWebService.Code;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Configuration;
using System.ServiceModel.Channels;
using System.ServiceModel.Web; 

namespace GmaWebService.CoreService
{
    public partial class CoreService : ServiceBase
    {
        private ServiceHost serviceHost = null;
        public CoreService()
        {
            this.ServiceName = "General Media Access WCF Service";
        }

        protected override void OnStart(string[] args)
        {
            if (serviceHost != null)
            {
                serviceHost.Close();
            }
           
            serviceHost = new ServiceHost(typeof(MediaAccessService));
         
            serviceHost.Open();
        }

        protected override void OnStop()
        {
            if (serviceHost != null)
            {
                serviceHost.Close();
                serviceHost = null;
            }
        }
    }
}
